/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
 * MemCache_Hybrid is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
*/

#include "spdlogger.h"
#include "spdlogger4c.h"
namespace ock {
namespace mmc {
int SPDLOG_Init(const char* path, int minLogLevel, int rotationFileSize, int rotationFileCount)
{
    return ock::mmc::log::SpdLogger::GetInstance().Initialize(path, minLogLevel + 1, rotationFileSize,
                                                              rotationFileCount);
}

int SPDLOG_AuditInit(const char* path, int rotationFileSize, int rotationFileCount)
{
    const int minLogLevel = 3;
    return ock::mmc::log::SpdLogger::GetAuditInstance().Initialize(path, minLogLevel, rotationFileSize,
                                                                   rotationFileCount);
}

void SPDLOG_LogMessage(int32_t level, const char* msg)
{
    ock::mmc::log::SpdLogger::GetInstance().LogMessage(level + 1, msg);
}

void SPDLOG_AuditLogMessage(const char* msg)
{
    ock::mmc::log::SpdLogger::GetAuditInstance().AuditLogMessage(msg);
}

const char* SPDLOG_GetLastErrorMessage()
{
    return ock::mmc::log::SpdLogger::GetLastErrorMessage();
}

int SPDLOG_ResetLogLevel(int logLevel)
{
    return ock::mmc::log::SpdLogger::GetInstance().SetLogMinLevel(logLevel);
}
}
}